from django.db import models

# Create your models here.

class userinfo(models.Model):
    # id=models.AutoField()
    phonename=models.CharField('登录账号',unique=True,primary_key=True,max_length=20)
    username=models.CharField('用户名',max_length=20)
    password=models.CharField('密码',max_length=100)

class tablecontent(models.Model):
    phonename=models.ForeignKey(userinfo,on_delete=models.CASCADE)
    publishcontent=models.CharField('内容',max_length=400,primary_key=True)
    publishtime=models.DateField('发表日期',auto_now=True)

class tablecomment(models.Model):
    phonename=models.ForeignKey(userinfo,on_delete=models.CASCADE)
    publishcontent=models.ForeignKey(tablecontent,on_delete=models.CASCADE)
    commentcontent=models.CharField('评论内容',max_length=200,primary_key=True)
    commenttime=models.DateField('评论日期',auto_now=True)
    towho=models.CharField('向谁发起评论',max_length=200,null=True)

# class tablereply(models.Model):
#     phonename=models.ForeignKey(userinfo,on_delete=models.CASCADE)
#     commentcontent=models.ForeignKey(tablecomment,on_delete=models.CASCADE)
#     reply=models.CharField('回复内容',max_length=200,primary_key=True)
#     replytime=models.DateField('回复日期',auto_now=True)
